package com.teacher.pc.controller;


import com.teacher.common.CommonResult;
import com.teacher.pojo.dto.certificatetask.CertificateTaskAddDto;
import com.teacher.pojo.dto.certificatetask.CertificateTaskUpdateDto;
import com.teacher.pojo.dto.innovativeundertakingtask.InnovativeUndertakingTaskAddDto;
import com.teacher.pojo.dto.innovativeundertakingtask.InnovativeUndertakingTaskUpdateDto;
import com.teacher.pojo.vo.certificatetask.CertificateTaskGetVo;
import com.teacher.pojo.vo.innovativeundertakingtask.InnovativeUndertakingTaskGetVo;
import com.teacher.service.ICertificateTaskService;
import com.teacher.service.IInnovativeUndertakingTaskService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 创新创业认定 一条 0.5 前端控制器
 * </p>
 *
 * @author zfm
 * @since 2021-08-13
 */
@RestController
@RequestMapping("/pc/innovative-undertaking-task")
public class InnovativeUndertakingTaskController {


    @Autowired
    private IInnovativeUndertakingTaskService iInnovativeUndertakingTaskService;

    /**
     * 发起证书申请审批流程
     *
     * @param dto
     * @return
     */
    @PostMapping
    @ApiOperation("发起创新创业认定审批流程 10->2+1创业班 20->申请完成互联网+项目 30->申请成功创业园项目 40->自主创新创业认定")
    public CommonResult<String> add(@RequestBody InnovativeUndertakingTaskAddDto dto) {
        return iInnovativeUndertakingTaskService.add(dto);
    }

    /**
     * 更新流程
     *
     * @param dto
     * @return
     */
    @PutMapping
    @ApiOperation("更新流程")
    public CommonResult<String> update(@RequestBody InnovativeUndertakingTaskUpdateDto dto) {
        return iInnovativeUndertakingTaskService.updateInfo(dto);
    }

    /**
     * 获取详情
     *
     * @return
     */
    @GetMapping("/{flowId}")
    @ApiOperation("获取详情")
    public CommonResult<InnovativeUndertakingTaskGetVo> getDetails(@PathVariable("flowId") Long id) {
        return iInnovativeUndertakingTaskService.getDetails(id);
    }

}

